from multiprocessing import Process,Lock

def f(i,lock):
    # 获取锁
    # lock.acquire()
    print(i)
    # lock.release()

def main():
    lock = Lock()
    for i in range(100):
        lock.acquire()
        process = Process(target=f,args=(i,lock))
        process.start()
        lock.release()
        # process.join()

if __name__ == '__main__':
    main()